<template>
	<view>
		<view class="share" @click="share">
			<image class="icon" mode="aspectFill" src="../../../static/ai/share.png"></image>
			分享
		</view>
		
		<u-modal :show="visible" width="520rpx" closeOnClickOverlay @confirm="visible = false">
			<view class="qrcode">
				<view>扫码二维码分享内容</view>
				<uqrcode v-if="visible" ref="uqrcode" canvas-id="qrcode" :value="value" :options="{ margin: 10, size: '480rpx' }"></uqrcode>
			</view>
		</u-modal>
	</view>
</template>

<script>
	import {H5_URL} from '@/config/app'
	export default {
		props: ['id'],
		data() {
			return {
				visible: false,
				value: ''
			}
		},
		methods: {
			share() {
				console.log(this.ids)
				this.value = H5_URL + '/pages/share?id=' + this.id
				this.visible = true
			}
		}
	}
</script>

<style lang="scss">
	.share {
		display: flex;
	
		.icon {
			width: 22rpx;
			height: 22rpx;
			margin-right: 8rpx;
		}
	}
	
	.qrcode {
		display: flex;
		flex-direction: column;
		text-align: center;
		font-size: 24rpx;
	}
</style>